<?php

namespace app\admin\controller\daily;
use think\Db;
use Exception;
/**
 * 用户冻结余额延迟到账  
 *
 * @icon fa fa-circle-o
 */
class Accountlog
{
    
    /**
     * Exchange模型对象
     * @var \app\admin\model\Exchange
     */
    protected $model = null;

    public function _initialize()
    {
        $this->model = new \app\admin\model\personal\AccountLog();
    }
    
    public function index()
    {
        //查询未到账但要到帐的余额明细
        $where['status'] = 0;
        $where['arrivaltime'] = ['lt',time()];
        $where['form'] = 1;
        $list = DB::name('account_log')->where($where)->field('money,uid,id')->select();
        if($list){
            foreach($list as $k=>$v){
                //改变到账状态，增加用户余额
                $data['status'] = 1;
                DB::name('account_log')->where(['id'=>$v['id']])->update($data);
                DB::name('personal')->where(['id'=>$v['uid']])->setInc( 'balance', $v['money'] );
            }
        }
        
    }


    

}
